<?php
namespace app\index\controller;

use think\Db;

class Index
{
    public function index(){
        return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V5.1<br/><span style="font-size:30px">12载初心不改（2006-2018） - 你值得信赖的PHP框架</span></p></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=64890268" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="eab4b9f840753f8e7"></think>';
    }

    public function upToDate(){
        $objPHPExcelReader = \PHPExcel_IOFactory::load("./static/001.xls");
        $sheet = $objPHPExcelReader->getSheet(0); // 读取第一个工作表(编号从 0 开始)
        $highestRow = $sheet->getHighestRow();           // 取得总行数

        $arr = array('A','B','C','D','E');
        $vv = array();

        for ($row = 1; $row <= $highestRow; $row++) {
            $row_arr = [];
            for ($column = 0; $arr[$column] != 'E'; $column++) {
                $val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue();
                $row_arr[] = $val;
            }
            $vv[] = $row_arr;
        }

        exit();


        $count = 0;
        if(!empty($vv)){
            array_shift($vv);
            $number_l = [];
            foreach ($vv as $key => $value){
                if($value[0] != ""){
                    $number = Db::name("num")->where("aid", 3)->where("number", $value[3])->find();
                    if($number["ub_id"] != 0){
                        $Info = [
                            "final_price" => $value[2],
                            "nid" => $number["nid"],
                            "ub_id" => $number["ub_id"]
                        ];
                        Db::name("goods")->where("lid", 2)->where("number", $value[0])->update($Info);
                        $count++;
                    }else{
                        $number_l[] = $value[$number];
                    }
                }
            }
            dump($number_l);
        }

        dump($count);

    }

}
